using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MetaBuilders.Irc;
using MetaBuilders.Irc.Messages;

namespace MetaBuilders.NeboTests {

	[TestClass]
	public class ChannelScopedTests : MessageTester {
		
		[TestMethod]
		public void ChannelScopedChatTest() {
			String[] raws = new String[] {
											 "CPRIVMSG artificer #foo :Fake Message"
										 };
			foreach( String raw in raws ) {
				AssertRoundTripAndType( raw, typeof ( ChannelScopedChatMessage ) );
			}

			ChannelScopedChatMessage msg;

			msg = MessageParserService.Service.Parse( raws[ 0 ] ) as ChannelScopedChatMessage;
			Assert.AreEqual( "artificer", msg.Target );
			Assert.AreEqual( "#foo", msg.Channel );
			Assert.AreEqual( "Fake Message", msg.Text );

		}

		[TestMethod]
		public void ChannelScopedNoticeTest() {
			String[] raws = new String[] {
											 "CNOTICE artificer #foo :Fake Message"
										 };
			foreach( String raw in raws ) {
				AssertRoundTripAndType( raw, typeof ( ChannelScopedNoticeMessage ) );
			}

			ChannelScopedNoticeMessage msg;

			msg = MessageParserService.Service.Parse( raws[ 0 ] ) as ChannelScopedNoticeMessage;
			Assert.AreEqual( "artificer", msg.Target );
			Assert.AreEqual( "#foo", msg.Channel );
			Assert.AreEqual( "Fake Message", msg.Text );
		}
	}
}
